package com.centerm.common.view.page;

import java.util.List;

import com.github.pagehelper.Page;

/**
 * @ClassName PageQueryResult
 * @Description: 分页查询结果类
 * @author lk
 * @date 2017年7月24日
 */
public class PageQueryResult<T> {
    
    /**
     * 总记录数
     */
    private Integer total;
    
    /**
     * 当前页
     */
    private Integer pageNum;
    
    /**
     * 单页的记录数
     */
    private Integer pageSize;
    
    /**
     * 总页数
     */
    private Integer pages;
    
    /**
     * 记录数据
     */
    private List<T> listData;
    
    public PageQueryResult() {}
    
    public PageQueryResult(Page<T> page, List<T> list) {
        this.pageNum = page.getPageNum()==0?1:page.getPageNum();
        this.pageSize = page.getPageSize();
        this.pages = page.getPages();
        this.total = (int) page.getTotal();
        this.listData = list;
    }
    
    public PageQueryResult(Page<T> page) {
        this.pageNum = page.getPageNum()==0?1:page.getPageNum();
        this.pageSize = page.getPageSize();
        this.pages = page.getPages();
        this.total = (int) page.getTotal();
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public List<T> getListData() {
        return listData;
    }

    public void setListData(List<T> listData) {
        this.listData = listData;
    }

}
